package router

import (
	"net/http"

	"github.com/gin-gonic/gin"
)

func Init() (r *gin.Engine) {
	r = gin.Default()
	r.HandleMethodNotAllowed = true
	RegisterAuth(r)
	RegisterUpload(r)
	RegisterFile(r)
	RegisterDashboard(r)
	r.NoRoute(func(ctx *gin.Context) {
		ctx.JSON(http.StatusNotFound, gin.H{
			"code":    http.StatusNotFound,
			"message": "接口不存在",
		})
	})
	return
}
